<?php 
if(!isset($_SESSION)) 
{ 
session_start(); 
} 

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">

.tbchung {background:white; cursor: default;}

.tbchung tr th {border-top:2px solid #828282;border-right:2px solid #828282; border-bottom:2px solid #828282;padding:6px; background-color:#DADADA}
.tbchung tr th.last {border-top:2px solid #828282;border-right:2px solid #828282; border-bottom:2px solid #828282;padding:6px;  background-color:#DADADA}
.tbchung tr th.first {border-top:2px solid #828282;border-left:2px solid #828282;border-right:2px solid #828282; border-bottom:2px solid #828282;padding:6px; background-color:#DADADA}
.tbchung tr td {padding:6px; border-right:2px solid #828282}
.tbchung tr td.last {padding:6px;  border-right:2px solid #828282}
.tbchung tr td.first {padding:6px; border-left:2px solid #828282; border-right:2px solid #828282}
@media print
{
div.break {page-break-after:always}
#first{
 	background: url("../images/bgth.png") repeat-x scroll 0 0 transparent;
}
}
</style>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("table tr:last td").each(function(){
		$(this).css('border-bottom','2px solid  #828282');
	});
});
</script>
</head>

<body style="background-color: #ffffff;text-align:center" onload="window.print()">
    
               <?php 
               $currentDate = date('Y-m-d h:m');
               $formatDate = "출력일: ".substr($currentDate, 0,4)."년".substr($currentDate, 5,2)."월".substr($currentDate, 8,2)."일 ".substr($currentDate, 11,2)."시".substr($currentDate, 14,2)."분";
               
               $index = 0;
               $mylist = $_SESSION['mylistcarnum'];
               if (isset($_SESSION['printview'])) {
               		$count =0;
	            	foreach ($_SESSION['printview'] as $key => $value) {
	            		$count+=1;
	            		if ($count==1) {
	            			?>
	            			<div style="width:950px;margin-top:40; margin-left:auto;margin-right:auto;" align="right"><label><?=$formatDate?></label></div>
	            			<table cellpadding="0" cellspacing="0" border="0" width="950px" class="tbchung" style="border:none;margin-top:10; margin-left:auto;margin-right:auto" id="tableheader2">
				             <tr>
				               		<th width="10%" id="first" align="center" class="first">순서</th>
			                    	<th width="18%" id="first" align="center">날짜</th>
			                    	<th width="18%" id="first" align="center">시간</th>
			                    	<th width="10%" id="first" align="center">차로</th>
			                    	<th width="18%" id="first" align="center">차량번호</th>
			                    	<th width="26%" id="first" class="last" align="center">촬영 장소</th>   
               				</tr>
	            			<?php 
	            		}
	                	$row = $mylist[$key];
	                	//array($row[id],$row[name],$row[car_datetime],$row[carnumber],$row[host],$row[filename],$row[isReg]);
	               		$index+=1;
	               		$m_date = substr($row[2], 0,4)."년".substr($row[2], 5,2)."월".substr($row[2], 8,2)."일";
	               		$m_time = substr($row[2], 11,2)."시".substr($row[2], 14,2)."분".substr($row[2], 17,2)."초";
	               		if ($count==38){
	            			$count=0;
	            			?>
	            			<tr class="trkhac" >
							 	<td  align="center" style="border-bottom:2px solid  #828282" class="first"><?=$index?></td>
							 	<td  align="center" style="border-bottom:2px solid  #828282"><?=$m_date?></td>
							 	<td  align="center" style="border-bottom:2px solid  #828282"><?=$m_time?></td>
							 	<td  align="center" style="border-bottom:2px solid  #828282">1</td>
							 	<td  align="center" style="border-bottom:2px solid  #828282"><?=$row[3]?>&nbsp;</td>
							 	<td class="last" align="center" style="border-bottom:2px solid  #828282"><?=$row[1]?></td>
							</tr> 
							</table>
							<div class="break"></div>
	            			<?php
	               		}else{
	               		?>
	               		<tr class="trkhac">
						 	<td  align="center"  class="first"><?=$index?></td>
						 	<td  align="center"><?=$m_date?></td>
						 	<td  align="center"><?=$m_time?></td>
						 	<td  align="center">1</td>
						 	<td  align="center"><?=$row[3]?>&nbsp;</td>
						 	<td class="last" align="center"><?=$row[1]?></td>
						</tr> 
	            	<?php 
	            		
	            	}
               }
				unset($_SESSION['printview']);		               		
               }?>
              
	
</body>     
</html>